#ifndef _ADDNODE_H_
#define _ADDNODE_H_

#include "ExprNode.h"

class AddNode : public ExprNode {
protected:
    ExprNode *left, *right;
public:
    AddNode(ExprNode *left, Token *add_token, ExprNode *right): ExprNode(add_token) {
        this->left = left;
        this->right = right;
    }
    string to_string_tree() {
        if (left == nullptr && right == nullptr)
            return this->to_string();
        string s;
        s.push_back('(');
        s += this->to_string();
        s.push_back(' ');
        s += left->to_string_tree();
        s.push_back(' ');
        s += right->to_string_tree();
        s.push_back(')');
        return s;
    }
};

#endif
